package com.hhm.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hhm.mapper.UserMapper;
import com.hhm.pojo.User;
import com.hhm.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper um;
    @Override
    public PageInfo<User> findAllByPage(Integer pageNum, Integer pageSize, User user) {
        PageHelper.startPage(pageNum, pageSize);
        List<User> list = um.findAll(user);
        return new PageInfo<>(list);
    }

    @Override
    public int del(Integer id) {

        return um.del(id);
    }

    @Override
    public User selectOne(Integer id) {
        return um.selectOne(id);
    }

    @Override
    public int updateUser(User user) {
        return um.updateUser(user);
    }
}
